<div class="block">
  <span class="font-semibold text-xl"><%= t ".link" %></span>
  <span class="help-text mb-2">
    <%= t ".invite_to_committee_help" %>
  </span>

  <div class="initiative__form__committee">
    <span>
      <%= decidim_initiatives.new_initiative_committee_request_url(current_initiative, locale: current_locale) %>
    </span>
    <div class="ml-auto fill-secondary inline-block">
      <button type="button" class="button button__sm button__text-secondary" data-controller="clipboard-copy" data-clipboard-copy="#urlShareLink-committee">
        <%= render_committee_tooltip %>
        <span class="sr-only"><%= t("decidim.shared.share_modal.copy_share_link") %></span>
      </button>
      <input id="urlShareLink-committee" type="text" class="!hidden" value="<%= decidim_initiatives.new_initiative_committee_request_url(current_initiative, locale: current_locale) %>" readonly>
    </div>
  </div>
</div>
<div class="block">
  <span class="font-semibold text-xl mb-4 block"><%= t ".title" %></span>
  <% if current_initiative.committee_members.empty? %>
    <%= t ".no_members_yet" %>
  <% end %>
  <% current_initiative.committee_members.each do |request| %>
    <div class="author mb-6" data-id="<%= request.id %>">
      <div class="profile__group__list">
        <%= card_for request.user %>
        <% if allowed_to? :approve, :initiative_committee_member, initiative: current_initiative, request: request %>
          <%= link_to(
                  approve_initiative_committee_request_path(current_initiative, request, locale: current_locale),
                  data: { confirm: t(".confirm_approve") },
                  class: "button button__sm button__transparent-secondary"
                ) do %>
                  <span><%= t(".approve") %></span>
                  <%= icon "check-line" %>
                <% end %>
        <% end %>
        <% if allowed_to? :revoke, :initiative_committee_member, initiative: current_initiative, request: request %>
          <%= link_to(
                  revoke_initiative_committee_request_path(current_initiative, request, locale: current_locale),
                  method: :delete,
                  data: { confirm: t(".confirm_revoke") },
                  class: "button button__sm button__transparent-secondary"
                ) do %>
                  <span><%= t(".revoke") %></span>
                  <%= icon "forbid-line" %>
                <% end %>
        <% end %>
      </div>
    </div>
  <% end %>
</div>

<%= append_javascript_pack_tag "decidim_initiatives_admin" %>
